package com.atguigu.baseservice.result;

import com.atguigu.baseservice.result.ResultCodeInfo;

/**
 * 自定义异常枚举类，实现自定义异常接口类，重写方法，操作枚举值
 */
public enum ResultCodeEnum implements ResultCodeInfo {

    //自定义异常枚举值
    SUCCESS(200, "成功"),
    BODY_NOT_MATCH(400, "数据格式不匹配"),
    NOT_FOUND(404, "访问资源不存在"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    SERVER_BUSY(503, "服务器正忙，请稍后再试"),
    REQUEST_METHOD_SUPPORT_ERROR(10001, "当前请求方法不支持"),
    REQUEST_DATA_NULL(10002, "当前请求参数为空"),
    USER_NOT_EXISTS(10003, "该用户不存在"),
    USER_INVALID(10004, "当前登录信息已失效,请重新登录"),
    PASSWORD_ERROR(10005, "密码错误"),
    USER_NAME_LOCK(10006, "该账号已被锁定"),
    USER_IS_EXISTS(10003, "该用户已存在"),
    FILE_UPLOAD_ERROR(10007, "文件上传失败"),
    ADD_ERROR(10008, "新增失败"),
    SAVE_ERROR(10009, "保存失败"),
    REMOVE_ERROR(10010, "删除失败"),
    REMOVECHA_ERROR(10011, "该分章节下存在视频课程，请先删除视频课程"),
    PUBLISH_FAIL(10012, "课程发布失败");



    //状态码
    private Integer code;

    //提示信息
    private String msg;

    //构造方法
    ResultCodeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }
}
